package org.example.controller;


import org.example.entity.Response;
import org.example.entity.Users;
import org.example.service.MainService;
import org.example.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
public class consumerUsercontroller {

    @Autowired
    private MainService userService;

    @PostMapping(value = {"/login"})
    public Response login(@RequestBody Users users) throws  Exception{
        return this.userService.login(users);
    }

    @PostMapping(value = {"/focus"})
    public Response focus(Integer befocusId,Integer focusId) throws  Exception{
        return this.userService.focus(befocusId,focusId);
    }

    @PostMapping(value = {"/cancelfocus"})
    public Response canclefocus(Integer befocusId,Integer focusId) throws  Exception{
        return this.userService.canclefocus(befocusId,focusId);
    }

    @PostMapping(value = {"/updateUserInfo"})
    public Response updateUserInfo(@RequestBody Users user) throws  Exception{
        return this.userService.updateUserInfo(user);
    }


    @PostMapping(value = {"/getUserInfo"})
    public Response getUserInfo(Integer uid) throws  Exception{
        return this.userService.getUserInfo(uid);
    }
//    @PostMapping(value = {"/dept/{deptno}"})
//    public Users queryDept(@PathVariable Integer deptno, String name, Integer age) throws  Exception{
//        System.out.println("7070 provider");
//        System.out.println("name:"+name);
//        System.out.println("age:"+age);
//        //Thread.sleep(3000);//测试超时时间 人为延长时间测试
//        return null;
//    }
}
